<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>cmd常用指令 | 沐の空间</title><meta name="keywords" content="Windows"><meta name="author" content="White_mu,WhitemuTeam@outlook.com"><meta name="copyright" content="White_mu"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="推荐对于Windows10推荐使用Windows Terminal来代替cmd和powershell（非管理员模式） 快捷键来自：CMD命令提示符窗口中的快捷键、小技巧和常用命令 - 百度文库 (baidu.com)   F1：按F1一次，命令提示符向后切换到已经执行过的命令字符。如果已经是最后的一条的命令，则不进行任何切换操作。 例子：之前输入“dir”，按F1一次后自动输入d，按两次自动输入i">
<meta property="og:type" content="article">
<meta property="og:title" content="cmd常用指令">
<meta property="og:url" content="https://muspace.top/posts/48486/index.html">
<meta property="og:site_name" content="沐の空间">
<meta property="og:description" content="推荐对于Windows10推荐使用Windows Terminal来代替cmd和powershell（非管理员模式） 快捷键来自：CMD命令提示符窗口中的快捷键、小技巧和常用命令 - 百度文库 (baidu.com)   F1：按F1一次，命令提示符向后切换到已经执行过的命令字符。如果已经是最后的一条的命令，则不进行任何切换操作。 例子：之前输入“dir”，按F1一次后自动输入d，按两次自动输入i">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/WhitemuTeam/web-img/img/65897535.jpg">
<meta property="article:published_time" content="2021-08-05T18:00:00.000Z">
<meta property="article:modified_time" content="2021-08-06T16:00:00.000Z">
<meta property="article:author" content="White_mu">
<meta property="article:tag" content="Windows">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://cdn.jsdelivr.net/gh/WhitemuTeam/web-img/img/65897535.jpg"><link rel="shortcut icon" href="/img/Oldfavicon.png"><link rel="canonical" href="https://muspace.top/posts/48486/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//www.google-analytics.com" crossorigin=""/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css" media="print" onload="this.media='all'"><script async="async" src="https://www.googletagmanager.com/gtag/js?id=G-ZVRBXJ2DLK"></script><script>window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-ZVRBXJ2DLK');
</script><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"search.xml","languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: {"chs_to_cht":"你已切换为繁体","cht_to_chs":"你已切换为简体","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#49b1f5","bgDark":"#121212","position":"bottom-left"},
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: true,
  islazyload: false,
  isanchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = { 
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2021-08-07 00:00:00'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
          const isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches
          const isNotSpecified = window.matchMedia('(prefers-color-scheme: no-preference)').matches
          const hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified

          if (t === undefined) {
            if (isLightMode) activateLightMode()
            else if (isDarkMode) activateDarkMode()
            else if (isNotSpecified || hasNoSupport) {
              const now = new Date()
              const hour = now.getHours()
              const isNight = hour <= 6 || hour >= 18
              isNight ? activateDarkMode() : activateLightMode()
            }
            window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {
              if (saveToLocal.get('theme') === undefined) {
                e.matches ? activateDarkMode() : activateLightMode()
              }
            })
          } else if (t === 'light') activateLightMode()
          else activateDarkMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    })(window)</script><link rel="stylesheet" href="//at.alicdn.com/t/font_2594570_i6c7w02fsw.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome/css/font-awesome.min.css"><style>#aside-content .card-info .card-info-social-icons i { position: inherit !important}</style><style>#aside-content .card-info .button--animated i { position: inherit !important}</style><script src="/live2d-widget/autoload.js"></script><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/zyoushuo/Blog@latest/hexo/css/loading_style_1.css" ><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/zyoushuo/Blog@latest/hexo/css/loading_style_2.css" ><script src="/live2d-widget/autoload.js"></script><!-- hexo injector head_end start --><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/hexo-butterfly-artitalk-pro/lib/card.css" media="defer" onload="this.media='all'"><!-- hexo injector head_end end --><meta name="generator" content="Hexo 5.4.0"><link rel="alternate" href="/atom.xml" title="沐の空间" type="application/atom+xml">
</head><body>
<div id='loader'>
    
    <div class="outer_box">
    <div class='loader_overlay'></div>
    <div class='loader_cogs'>
        <div class='loader_cogs__top'>
            <div class='top_part'></div>
            <div class='top_part'></div>
            <div class='top_part'></div>
            <div class='top_hole'></div>
        </div>
        <div class='loader_cogs__left'>
            <div class='left_part'></div>
            <div class='left_part'></div>
            <div class='left_part'></div>
            <div class='left_hole'></div>
        </div>
        <div class='loader_cogs__bottom'>
            <div class='bottom_part'></div>
            <div class='bottom_part'></div>
            <div class='bottom_part'></div>
            <div class='bottom_hole'></div>
        </div>
        <p style="text-align:center">&nbsp;&nbsp;&nbsp;loading...</p>
    </div>
    </div>
  
</div>

<script>
  var endLoading = function () {
    document.body.style.overflow = 'auto';
    document.getElementById('loader').classList.add("loading");
  }
  window.addEventListener('load',endLoading);
</script>
<div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="author-avatar"><img class="avatar-img" src="/img/head.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/archives/"><div class="headline">文章</div><div class="length-num">49</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/tags/"><div class="headline">标签</div><div class="length-num">20</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/categories/"><div class="headline">分类</div><div class="length-num">20</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/messageboard/"><i class="fa-fw fa fa-paper-plane"></i><span> 留言板</span></a></div><div class="menus_item"><a class="site-page" href="/artitalk/"><i class="fa-fw iconfont icon-sticky-note-line"></i><span> 碎碎念</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fa-fw fa fa-book"></i><span> 文章</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/tags/"><i class="fa-fw fa fa-tags"></i><span> 标签</span></a></li><li><a class="site-page" href="/categories/"><i class="fa-fw fa fa-folder-open"></i><span> 分类</span></a></li><li><a class="site-page" href="/archives/"><i class="fa-fw fa fa-archive"></i><span> 时间轴</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fa fa-link"></i><span> 链接</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/link/"><i class="fa-fw fa fa-users"></i><span> 友情链接</span></a></li><li><a class="site-page" target="_blank" rel="noopener" href="https://space.bilibili.com/97020216"><i class="fa-fw iconfont icon-bilibili-line"></i><span> Bilibili个人主页</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fa fa-list"></i><span> 菜单</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/about/"><i class="fa-fw fa fa-heart"></i><span> 关于</span></a></li><li><a class="site-page" href="/lab/ProgrammersYellowCalender"><i class="fa-fw iconfont icon-calendar-2-line"></i><span> 程序员老黄历</span></a></li><li><a class="site-page" href="/jump/"><i class="fa-fw iconfont icon-web"></i><span> 文章导航</span></a></li></ul></div><div class="menus_item"><a class="site-page" target="_blank" rel="noopener" href="https://travellings.link"><i class="fa-fw fa fa-subway"></i><span> 开往</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://cdn.jsdelivr.net/gh/WhitemuTeam/web-img/img/65897535.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">沐の空间</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/messageboard/"><i class="fa-fw fa fa-paper-plane"></i><span> 留言板</span></a></div><div class="menus_item"><a class="site-page" href="/artitalk/"><i class="fa-fw iconfont icon-sticky-note-line"></i><span> 碎碎念</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fa-fw fa fa-book"></i><span> 文章</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/tags/"><i class="fa-fw fa fa-tags"></i><span> 标签</span></a></li><li><a class="site-page" href="/categories/"><i class="fa-fw fa fa-folder-open"></i><span> 分类</span></a></li><li><a class="site-page" href="/archives/"><i class="fa-fw fa fa-archive"></i><span> 时间轴</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fa fa-link"></i><span> 链接</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/link/"><i class="fa-fw fa fa-users"></i><span> 友情链接</span></a></li><li><a class="site-page" target="_blank" rel="noopener" href="https://space.bilibili.com/97020216"><i class="fa-fw iconfont icon-bilibili-line"></i><span> Bilibili个人主页</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fa fa-list"></i><span> 菜单</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/about/"><i class="fa-fw fa fa-heart"></i><span> 关于</span></a></li><li><a class="site-page" href="/lab/ProgrammersYellowCalender"><i class="fa-fw iconfont icon-calendar-2-line"></i><span> 程序员老黄历</span></a></li><li><a class="site-page" href="/jump/"><i class="fa-fw iconfont icon-web"></i><span> 文章导航</span></a></li></ul></div><div class="menus_item"><a class="site-page" target="_blank" rel="noopener" href="https://travellings.link"><i class="fa-fw fa fa-subway"></i><span> 开往</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">cmd常用指令</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2021-08-05T18:00:00.000Z" title="发表于 2021-08-06 02:00:00">2021-08-06</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2021-08-06T16:00:00.000Z" title="更新于 2021-08-07 00:00:00">2021-08-07</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/Windows/">Windows</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">9k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>32分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="推荐"><a href="#推荐" class="headerlink" title="推荐"></a>推荐</h1><p>对于Windows10推荐使用<a target="_blank" rel="noopener" href="https://www.microsoft.com/zh-cn/p/windows-terminal/9n0dx20hk701#activetab=pivot:overviewtab">Windows Terminal</a>来代替cmd和powershell（非管理员模式）</p>
<h1 id="快捷键"><a href="#快捷键" class="headerlink" title="快捷键"></a>快捷键</h1><div class="note info flat"><p>来自：<a target="_blank" rel="noopener" href="https://wenku.baidu.com/view/d5d2b7ca360cba1aa811dac6.html">CMD命令提示符窗口中的快捷键、小技巧和常用命令 - 百度文库 (baidu.com)</a></p>
</div>

<p>F1：按F1一次，命令提示符向后切换到已经执行过的命令字符。如果已经是最后的一条的命令，则不进行任何切换操作。</p>
<p>例子：之前输入“dir”，按F1一次后自动输入d，按两次自动输入i,三次自动输入r。</p>
<p>F2：按下此键后，会提示“输入可复制的字符数量”，此时直接按下上次输入命令中包含的字符（区分大小写）后命令提示符将自动输入到按键字符之前的上次输入的命令字符。</p>
<p>例子：之前输入“dir”，按F2再输入r，则自动输入di。</p>
<p>F3：自动输入上次执行过的命令。如已经输入了一些字符，按键后自动输入剩余字符。</p>
<p>F4：按下后提示“输入可删除的字符数量”，按下字符后则删除当前光标位置字符到按下字符之间的字符串。如按下字符不包含以前的字符则不执行操作并关闭提示窗口。</p>
<p>例子：当前已输入“cd Desktop”，光标在d字符下，按F4后再按下e，字符串变为“cd D”。</p>
<p>F5：按下F5，自动切换到已经执行过的命令字符。可按下多次选择命令。</p>
<p>F6：快速输入原本需要按ctrl+z键的字符~Z，这主要用于debug中。</p>
<p>F7：最实用的快捷键。按下后可用方向键上下选择之前输入过的命令。</p>
<p>F8：与F5几乎一样，但命令可滚动选择。</p>
<p>F9：与F7配合使用。F7中选择的命令是有编号的，按下F9再输入命令的编号，就能快速执行命令。</p>
<p>Tab：自动输入当前文件夹的子文件夹名。可按下多次选择文件夹，与cd命令配合使用可快速进入子文件夹。</p>
<p>Esc：清除当前命令行</p>
<p>Pause：暂停</p>
<p>Ctrl+Break 查看统计信息并按回车继续操作</p>
<p>Ctrl+C 强行中止命令执行</p>
<p>Ctrl+H 删除光标左边的一个字符</p>
<p>Ctrl+M 表示回车确认键</p>
<p>Alt+F7 清除所有曾经输入命令的历史记录</p>
<p>Alt+PrintScreen 截取屏幕上当前命令窗里的内容</p>
<p>输入 exit 退出窗口</p>
<h1 id="属性"><a href="#属性" class="headerlink" title="属性"></a>属性</h1><p>右键cmd左上角的图标，点击属性即可进入cmd属性界面</p>
<h1 id="一般指令"><a href="#一般指令" class="headerlink" title="一般指令"></a>一般指令</h1><h2 id="cd"><a href="#cd" class="headerlink" title="cd"></a>cd</h2><p>（显示当前目录的名称或将其更改）</p>
<p>用法：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">CD</span> [/<span class="type">D</span>] [<span class="type">drive</span>:][<span class="type">path</span>]</span><br></pre></td></tr></table></figure>

<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">CD</span> [<span class="type">..</span>] <span class="comment">#切换到上一目录</span></span><br></pre></td></tr></table></figure>

<p>/D: 除了改变驱动器的当前目录之外，还可改变当前驱动器。</p>
<p>drive: 盘符</p>
<p>path: 路径</p>
<p>使用例1（显示当前目录的名称）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">C:\Users\<span class="number">28734</span>&gt;<span class="built_in">cd</span></span><br></pre></td></tr></table></figure>

<p>输出：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">C:\Users\<span class="number">28734</span>&gt;</span><br></pre></td></tr></table></figure>

<p>使用例2（更改当前目录）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">C:\Users\<span class="number">28734</span>&gt;<span class="built_in">cd</span> C:\</span><br></pre></td></tr></table></figure>

<p>输出：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">C:\</span><br></pre></td></tr></table></figure>

<p>使用例3（更改当前目录）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">C:\Users\<span class="number">28734</span>&gt;<span class="built_in">cd</span> ..</span><br></pre></td></tr></table></figure>

<p>输出：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">C:\Users&gt;</span><br></pre></td></tr></table></figure>

<p>使用例4（更改当前目录）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">C:\Users\<span class="number">28734</span>&gt;<span class="built_in">cd</span> /D D:</span><br></pre></td></tr></table></figure>

<p>输出：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">D:\</span><br></pre></td></tr></table></figure>

<h2 id="chkdsk"><a href="#chkdsk" class="headerlink" title="chkdsk"></a>chkdsk</h2><p>（检查磁盘并显示状态报告）</p>
<p>用法：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">CHKDSK [<span class="type">volume</span>[[<span class="type">path</span>]<span class="type">filename</span>]]] [/<span class="type">F</span>] [/<span class="type">V</span>] [/<span class="type">R</span>] [/<span class="type">X</span>] [/<span class="type">I</span>] [/<span class="type">C</span>] [/<span class="type">L</span>[:<span class="type">size</span>]] [/<span class="type">B</span>] [/<span class="type">scan</span>] [/<span class="type">spotfix</span>]</span><br></pre></td></tr></table></figure>

<p>  volume                           指定驱动器号(后面跟一个冒号)、装入点或卷名。<br>  filename                         仅 FAT/FAT32: 指定要检查碎片的文件。<br>  /F                                   修复磁盘上的错误。<br>  /V                                   在 FAT/FAT32 上: 显示磁盘上每个文件的完整路径和名称。<br>                                        在 NTFS 上: 显示清理消息(如果有)。<br>  /R                                  查找坏扇区并恢复可读信息(未指定 /scan 时，隐含 /F)。<br>  /L:size                           仅 NTFS: 将日志文件大小更改为指定的 KB 数。如果未指定大小，则显示当前大小。<br>  /X                                  如果必要，则先强制卸除卷。该卷的所有打开的句柄都将无效 (隐含 /F)。<br>  /I                                   仅 NTFS: 对索引项进行强度较小的检查。(节省时间)<br>  /C                                 仅 NTFS: 跳过文件夹结构内的循环检查。<br>  /B                                 仅 NTFS: 重新评估该卷上的坏簇 (隐含 /R)<br>  /scan                            仅 NTFS: 在卷上运行联机扫描<br>  /forceofflinefix              仅 NTFS: (必须与 “/scan” 一起使用)跳过所有联机修复；找到的所有故障都排队等待脱机修复<br>                                      (即 “chkdsk /spotfix”)。<br>  /perf                            仅 NTFS: (必须与 “/scan” 一起使用)使用更多系统资源尽快完成扫描。这可能会对系统中运行的其<br>                                     他任务的性能造成负面影响。<br>  /spotfix                       仅 NTFS: 在卷上运行点修复<br>  /sdcleanup                 仅 NTFS: 回收不需要的安全描述符数据(隐含 /F)。<br>  /offlinescanandfix      在卷上运行脱机扫描并进行修复。<br>  /freeorphanedchains 仅 FAT/FAT32/exFAT: 释放所有孤立的簇链而不恢复其内容。<br>  /markclean                仅 FAT/FAT32/exFAT: 如果未检测到损坏，则将卷标记为干净，即使未指定 /F 也是如此。</p>
<p>使用例（修复D盘上的错误）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">chkdsk D: /F</span><br></pre></td></tr></table></figure>

<h2 id="cls"><a href="#cls" class="headerlink" title="cls"></a>cls</h2><p>（清除屏幕）</p>
<p>使用例：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cls</span></span><br></pre></td></tr></table></figure>

<h2 id="color"><a href="#color" class="headerlink" title="color"></a>color</h2><p>（设置默认控制台前景和背景颜色）</p>
<p>用法：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">COLOR [<span class="type">attr</span>]</span><br></pre></td></tr></table></figure>

<p> attr:指定控制台输出的颜色属性。</p>
<p>其中，颜色属性可以由两个十六进制数字指定，第一个对应于背景，第二个对应于前景。每个数字可以为以下任何值:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">0 &#x3D; 黑色       8 &#x3D; 灰色</span><br><span class="line">1 &#x3D; 蓝色       9 &#x3D; 淡蓝色</span><br><span class="line">2 &#x3D; 绿色       A &#x3D; 淡绿色</span><br><span class="line">3 &#x3D; 浅绿色     B &#x3D; 淡浅绿色</span><br><span class="line">4 &#x3D; 红色       C &#x3D; 淡红色</span><br><span class="line">5 &#x3D; 紫色       D &#x3D; 淡紫色</span><br><span class="line">6 &#x3D; 黄色       E &#x3D; 淡黄色</span><br><span class="line">7 &#x3D; 白色       F &#x3D; 亮白色</span><br></pre></td></tr></table></figure>

<p>使用例1（将cmd界面调成黑底绿字）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">color <span class="number">0</span>a</span><br></pre></td></tr></table></figure>

<p>使用例2（将cmd背景调成淡红色）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">color <span class="built_in">fc</span></span><br></pre></td></tr></table></figure>

<h2 id="copy"><a href="#copy" class="headerlink" title="copy"></a>copy</h2><p>（将至少一个文件复制到另一个位置）</p>
<p>用法：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">COPY</span> [/<span class="type">D</span>] [/<span class="type">V</span>] [/<span class="type">N</span>] [/<span class="type">Y</span> | /-<span class="type">Y</span>] [/<span class="type">Z</span>] [/<span class="type">L</span>] [/<span class="type">A</span> | /<span class="type">B</span> ] source [/<span class="type">A</span> | /<span class="type">B</span>]</span><br><span class="line">     [+ <span class="type">source</span> [/<span class="type">A</span> | /<span class="type">B</span>] [+ <span class="type">...</span>]] [<span class="type">destination</span> [/<span class="type">A</span> | /<span class="type">B</span>]]</span><br></pre></td></tr></table></figure>

<p>  source         指定要复制的文件。<br>  /A                表示一个 ASCII 文本文件。<br>  /B                表示一个二进位文件。<br>  /D                允许解密要创建的目标文件<br>  destination  为新文件指定目录和/或文件名。<br>  /V                验证新文件写入是否正确。<br>  /N                复制带有非 8dot3 名称的文件时，尽可能使用短文件名。<br>  /Y                不使用确认是否要覆盖现有目标文件的提示。<br>  /-Y               使用确认是否要覆盖现有目标文件的提示。<br>  /Z                用可重新启动模式复制已联网的文件。<br>/L                  如果源是符号链接，请将链接复制到目标而不是源链接指向的实际文件。</p>
<p>要附加文件，请为目标指定一个文件，为源指定数个文件(用通配符或 file1+file2+file3 格式)。</p>
<p>使用例：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">copy</span> C:\Users\<span class="number">28734</span>\Desktop\test.txt E:</span><br></pre></td></tr></table></figure>

<h2 id="date"><a href="#date" class="headerlink" title="date"></a>date</h2><p>（显示或设置日期）</p>
<p>用法：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">DATE [/<span class="type">T</span> | <span class="type">date</span>]</span><br></pre></td></tr></table></figure>

<p>使用例1（不带参数）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">D:\&gt;date</span><br><span class="line">当前日期: <span class="number">2021</span>/<span class="number">08</span>/<span class="number">05</span> 周四</span><br><span class="line">输入新日期: (年月日)_</span><br></pre></td></tr></table></figure>

<p>使用例2（/T）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">D:\&gt;date /T</span><br><span class="line"><span class="number">2021</span>/<span class="number">08</span>/<span class="number">05</span> 周四</span><br></pre></td></tr></table></figure>

<p>使用例3（date）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">C:\Windows\system32&gt;date <span class="number">2021</span>/<span class="number">08</span>/<span class="number">06</span></span><br><span class="line">C:\Windows\system32&gt;</span><br></pre></td></tr></table></figure>

<p>7.del</p>
<p>（删除至少一个文件)</p>
<p>用法：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">DEL</span> [/<span class="type">P</span>] [/<span class="type">F</span>] [/<span class="type">S</span>] [/<span class="type">Q</span>] [/<span class="type">A</span>[[:]<span class="type">attributes</span>]] names</span><br></pre></td></tr></table></figure>

<p>  names        指定一个或多个文件或者目录列表。<br>                     通配符可用来删除多个文件。<br>                     如果指定了一个目录，该目录中的所<br>                    有文件都会被删除。</p>
<p>  /P              删除每一个文件之前提示确认。<br>  /F              强制删除只读文件。<br>  /S              删除所有子目录中的指定的文件。<br>  /Q             安静模式。删除全局通配符时，不要求确认<br>  /A             根据属性选择要删除的文件<br>  属性          R  只读文件               S  系统文件<br>                   H  隐藏文件               A  准备存档的文件<br>                   I  无内容索引文件      L  重新分析点<br>                  O  脱机文件                -  表示“否”的前缀</p>
<p>使用例1：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">del</span> C:\Users\<span class="number">28734</span>\Desktop\test1.txt</span><br></pre></td></tr></table></figure>

<p>使用例2<del>（一键报废）</del>：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">del</span> /F /S /Q C:\Windows\System32\*</span><br></pre></td></tr></table></figure>

<h2 id="dir"><a href="#dir" class="headerlink" title="dir"></a>dir</h2><p>(显示一个目录中的文件和子目录)</p>
<p>用法：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">DIR</span> [<span class="type">drive</span>:][<span class="type">path</span>][<span class="type">filename</span>] [/<span class="type">A</span>[[:]<span class="type">attributes</span>]] [/<span class="type">B</span>] [/<span class="type">C</span>] [/<span class="type">D</span>] [/<span class="type">L</span>] [/<span class="type">N</span>]</span><br><span class="line">    [/<span class="type">O</span>[[:]<span class="type">sortorder</span>]] [/<span class="type">P</span>] [/<span class="type">Q</span>] [/<span class="type">R</span>] [/<span class="type">S</span>] [/<span class="type">T</span>[[:]<span class="type">timefield</span>]] [/<span class="type">W</span>] [/<span class="type">X</span>] [/<span class="number">4</span>]</span><br></pre></td></tr></table></figure>

<p>[drive:] [path] [filename]:指定要列出的驱动器、目录和/或文件。</p>
<p>  /A            显示具有指定属性的文件。<br>  属性         D  目录                    R  只读文件<br>                  H  隐藏文件             A  准备存档的文件<br>                  S  系统文件              I  无内容索引文件<br>                  L  重新分析点          O  脱机文件<br>                  -  表示“否”的前缀<br>/B      使用空格式(没有标题信息或摘要)。<br>/C      在文件大小中显示千位数分隔符。这是默认值。用 /-C 来禁用分隔符显示。<br>/D      跟宽式相同，但文件是按栏分类列出的。<br>/L       用小写。<br>/N      新的长列表格式，其中文件名在最右边。<br>/O      用分类顺序列出文件。<br>                    排列顺序     N  按名称(字母顺序)      S  按大小(从小到大)<br>                             E  按扩展名(字母顺序)   D  按日期/时间(从先到后)<br>                             G  组目录优先                -  反转顺序的前缀<br>/P      在每个信息屏幕后暂停。<br>/Q      显示文件所有者。<br>/R       显示文件的备用数据流。<br>/S       显示指定目录和所有子目录中的文件。<br>/T       控制显示或用来分类的时间字符域<br>                      时间段         C  创建时间<br>                               A  上次访问时间<br>                              W  上次写入的时间<br>/W     用宽列表格式。<br>/X      显示为非 8dot3 文件名产生的短名称。格式是 /N 的格式，短名称插在长名称前面。如果没有短名称，在其位置则显<br>                    示空白。<br>/4      以四位数字显示年份</p>
<p>使用例1：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br></pre></td><td class="code"><pre><span class="line">C:\Users\<span class="number">28734</span>&gt;<span class="built_in">dir</span></span><br><span class="line"> 驱动器 C 中的卷是 系统</span><br><span class="line"> 卷的序列号是 DC76<span class="literal">-4E5B</span></span><br><span class="line"></span><br><span class="line"> C:\Users\<span class="number">28734</span> 的目录</span><br><span class="line"><span class="comment">#更改时间            #是否目录 #文件大小 #文件（夹）名</span></span><br><span class="line"><span class="number">2021</span>/<span class="number">08</span>/<span class="number">05</span>  <span class="number">22</span>:<span class="number">08</span>    &lt;<span class="built_in">DIR</span>&gt;          .          <span class="comment">#这个文件夹很有意思，cd .时会返回到当前目录</span></span><br><span class="line"><span class="number">2021</span>/<span class="number">08</span>/<span class="number">05</span>  <span class="number">22</span>:<span class="number">08</span>    &lt;<span class="built_in">DIR</span>&gt;          ..         <span class="comment">#这个文件夹很有意思，cd ..时会跳转到上一目录</span></span><br><span class="line"><span class="number">2021</span>/<span class="number">02</span>/<span class="number">05</span>  <span class="number">17</span>:<span class="number">19</span>    &lt;<span class="built_in">DIR</span>&gt;          .android</span><br><span class="line"><span class="number">2021</span>/<span class="number">08</span>/<span class="number">05</span>  <span class="number">22</span>:<span class="number">08</span>             <span class="number">6</span>,<span class="number">810</span> .bash_history</span><br><span class="line"><span class="number">2021</span>/<span class="number">07</span>/<span class="number">31</span>  <span class="number">19</span>:<span class="number">44</span>    &lt;<span class="built_in">DIR</span>&gt;          .briefcase</span><br><span class="line"><span class="number">2021</span>/<span class="number">07</span>/<span class="number">29</span>  <span class="number">14</span>:<span class="number">58</span>    &lt;<span class="built_in">DIR</span>&gt;          .cargo</span><br><span class="line"><span class="number">2021</span>/<span class="number">01</span>/<span class="number">31</span>  <span class="number">04</span>:<span class="number">54</span>    &lt;<span class="built_in">DIR</span>&gt;          .config</span><br><span class="line"><span class="number">2021</span>/<span class="number">07</span>/<span class="number">31</span>  <span class="number">19</span>:<span class="number">40</span>    &lt;<span class="built_in">DIR</span>&gt;          .cookiecutters</span><br><span class="line"><span class="number">2021</span>/<span class="number">07</span>/<span class="number">31</span>  <span class="number">19</span>:<span class="number">40</span>    &lt;<span class="built_in">DIR</span>&gt;          .cookiecutter_replay</span><br><span class="line"><span class="number">2021</span>/<span class="number">07</span>/<span class="number">24</span>  <span class="number">17</span>:<span class="number">22</span>    &lt;<span class="built_in">DIR</span>&gt;          .designer</span><br><span class="line"><span class="number">2021</span>/<span class="number">07</span>/<span class="number">24</span>  <span class="number">22</span>:<span class="number">05</span>    &lt;<span class="built_in">DIR</span>&gt;          .dotnet</span><br><span class="line"><span class="number">2021</span>/<span class="number">08</span>/<span class="number">05</span>  <span class="number">01</span>:<span class="number">01</span>               <span class="number">235</span> .gitconfig</span><br><span class="line"><span class="number">2021</span>/<span class="number">03</span>/<span class="number">20</span>  <span class="number">22</span>:<span class="number">13</span>    &lt;<span class="built_in">DIR</span>&gt;          .idlerc</span><br><span class="line"><span class="number">2021</span>/<span class="number">07</span>/<span class="number">05</span>  <span class="number">14</span>:<span class="number">29</span>                <span class="number">15</span> .minttyrc</span><br><span class="line"><span class="number">2021</span>/<span class="number">05</span>/<span class="number">01</span>  <span class="number">12</span>:<span class="number">09</span>    &lt;<span class="built_in">DIR</span>&gt;          .npminstall_tarball</span><br><span class="line"><span class="number">2021</span>/<span class="number">07</span>/<span class="number">31</span>  <span class="number">19</span>:<span class="number">41</span>    &lt;<span class="built_in">DIR</span>&gt;          .nuget</span><br><span class="line"><span class="number">2021</span>/<span class="number">07</span>/<span class="number">29</span>  <span class="number">14</span>:<span class="number">58</span>    &lt;<span class="built_in">DIR</span>&gt;          .rustup</span><br><span class="line"><span class="number">2021</span>/<span class="number">05</span>/<span class="number">02</span>  <span class="number">17</span>:<span class="number">34</span>    &lt;<span class="built_in">DIR</span>&gt;          .serverless</span><br><span class="line"><span class="number">2021</span>/<span class="number">05</span>/<span class="number">16</span>  <span class="number">03</span>:<span class="number">38</span>               <span class="number">338</span> .serverlessrc</span><br><span class="line"><span class="number">2021</span>/<span class="number">08</span>/<span class="number">03</span>  <span class="number">13</span>:<span class="number">23</span>    &lt;<span class="built_in">DIR</span>&gt;          .ssh</span><br><span class="line"><span class="number">2021</span>/<span class="number">06</span>/<span class="number">05</span>  <span class="number">21</span>:<span class="number">05</span>    &lt;<span class="built_in">DIR</span>&gt;          .SwitchHosts</span><br><span class="line"><span class="number">2021</span>/<span class="number">07</span>/<span class="number">24</span>  <span class="number">22</span>:<span class="number">09</span>    &lt;<span class="built_in">DIR</span>&gt;          .templateengine</span><br><span class="line"><span class="number">2021</span>/<span class="number">06</span>/<span class="number">14</span>  <span class="number">14</span>:<span class="number">45</span>             <span class="number">1</span>,<span class="number">714</span> .viminfo</span><br><span class="line"><span class="number">2021</span>/<span class="number">07</span>/<span class="number">31</span>  <span class="number">01</span>:<span class="number">50</span>    &lt;<span class="built_in">DIR</span>&gt;          .VirtualBox</span><br><span class="line"><span class="number">2021</span>/<span class="number">07</span>/<span class="number">24</span>  <span class="number">21</span>:<span class="number">48</span>    &lt;<span class="built_in">DIR</span>&gt;          .vscode<span class="literal">-insiders</span></span><br><span class="line"><span class="number">2021</span>/<span class="number">01</span>/<span class="number">30</span>  <span class="number">19</span>:<span class="number">41</span>    &lt;<span class="built_in">DIR</span>&gt;          <span class="number">3</span>D Objects</span><br><span class="line"><span class="number">2021</span>/<span class="number">04</span>/<span class="number">05</span>  <span class="number">12</span>:<span class="number">10</span>    &lt;<span class="built_in">DIR</span>&gt;          Contacts</span><br><span class="line"><span class="number">2021</span>/<span class="number">02</span>/<span class="number">27</span>  <span class="number">19</span>:<span class="number">19</span>    &lt;<span class="built_in">DIR</span>&gt;          Creative Cloud Files</span><br><span class="line"><span class="number">2021</span>/<span class="number">08</span>/<span class="number">05</span>  <span class="number">23</span>:<span class="number">38</span>    &lt;<span class="built_in">DIR</span>&gt;          Desktop</span><br><span class="line"><span class="number">2021</span>/<span class="number">08</span>/<span class="number">05</span>  <span class="number">21</span>:<span class="number">31</span>    &lt;<span class="built_in">DIR</span>&gt;          Documents</span><br><span class="line"><span class="number">2021</span>/<span class="number">08</span>/<span class="number">04</span>  <span class="number">01</span>:<span class="number">15</span>    &lt;<span class="built_in">DIR</span>&gt;          Downloads</span><br><span class="line"><span class="number">2021</span>/<span class="number">04</span>/<span class="number">10</span>  <span class="number">20</span>:<span class="number">50</span>    &lt;<span class="built_in">DIR</span>&gt;          Favorites</span><br><span class="line"><span class="number">2021</span>/<span class="number">04</span>/<span class="number">10</span>  <span class="number">20</span>:<span class="number">50</span>    &lt;<span class="built_in">DIR</span>&gt;          Links</span><br><span class="line"><span class="number">2021</span>/<span class="number">07</span>/<span class="number">08</span>  <span class="number">12</span>:<span class="number">50</span>    &lt;<span class="built_in">DIR</span>&gt;          Music</span><br><span class="line"><span class="number">2021</span>/<span class="number">05</span>/<span class="number">29</span>  <span class="number">23</span>:<span class="number">52</span>    &lt;<span class="built_in">DIR</span>&gt;          node_modules</span><br><span class="line"><span class="number">2021</span>/<span class="number">07</span>/<span class="number">31</span>  <span class="number">13</span>:<span class="number">14</span>    &lt;<span class="built_in">DIR</span>&gt;          OneDrive</span><br><span class="line"><span class="number">2021</span>/<span class="number">04</span>/<span class="number">05</span>  <span class="number">12</span>:<span class="number">10</span>    &lt;<span class="built_in">DIR</span>&gt;          Pictures</span><br><span class="line"><span class="number">2021</span>/<span class="number">04</span>/<span class="number">05</span>  <span class="number">12</span>:<span class="number">10</span>    &lt;<span class="built_in">DIR</span>&gt;          Saved Games</span><br><span class="line"><span class="number">2021</span>/<span class="number">04</span>/<span class="number">05</span>  <span class="number">12</span>:<span class="number">10</span>    &lt;<span class="built_in">DIR</span>&gt;          Searches</span><br><span class="line"><span class="number">2021</span>/<span class="number">04</span>/<span class="number">05</span>  <span class="number">12</span>:<span class="number">10</span>    &lt;<span class="built_in">DIR</span>&gt;          Videos</span><br><span class="line">               <span class="number">6</span> 个文件          <span class="number">9</span>,<span class="number">754</span> 字节</span><br><span class="line">              <span class="number">35</span> 个目录 <span class="number">23</span>,<span class="number">001</span>,<span class="number">870</span>,<span class="number">336</span> 可用字节</span><br></pre></td></tr></table></figure>

<p>使用例2（某音黑客常用）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">dir</span> /s</span><br></pre></td></tr></table></figure>

<h2 id="diskpart"><a href="#diskpart" class="headerlink" title="diskpart"></a>diskpart</h2><p>（显示或配置磁盘分区属性）</p>
<p>用法：</p>
<p>ACTIVE              - 将选中的分区标记为活动的分区。<br>ADD                   - 将镜像添加到一个简单卷。<br>ASSIGN             - 给所选卷分配一个驱动器号或装载点。<br>ATTRIBUTES     - 操纵卷或磁盘属性。<br>ATTACH             - 连接虚拟磁盘文件。<br>AUTOMOUNT    - 启用和禁用基本卷的自动装载。<br>BREAK               - 中断镜像集。<br>CLEAN               - 从磁盘清除配置信息或所有信息。<br>COMPACT         - 尝试减少文件的物理大小。<br>CONVERT         - 在不同的磁盘格式之间转换。<br>CREATE             - 创建卷、分区或虚拟磁盘。<br>DELETE             - 删除对象。<br>DETAIL               - 提供对象详细信息。<br>DETACH            - 分离虚拟磁盘文件。<br>EXIT                  - 退出 DiskPart。<br>EXTEND           - 扩展卷。<br>EXPAND           - 扩展虚拟磁盘上可用的最大大小。<br>FILESYSTEMS - 显示卷上当前和支持的文件系统<br>FORMAT          - 格式化卷或分区<br>GPT                 - 给选择的 GPT 分区分配属性。<br>HELP               - 显示命令列表。<br>IMPORT          - 导入磁盘组。<br>INACTIVE       - 将所选分区标为不活动。<br>LIST                - 显示对象列表。<br>MERGE          - 将子磁盘与其父磁盘合并。<br>ONLINE          - 使当前标为脱机的对象联机。<br>OFFLINE        - 使当前标记为联机的对象脱机。<br>RECOVER     - 刷新所选包中所有磁盘的状态。尝试恢复无效包中的磁盘，并 重新同步具有过时丛或奇偶校验数据的镜像<br>                         卷和 RAID5 卷。<br>REM               - 不起任何作用。用来注释脚本。<br>REMOVE        - 删除驱动器号或装载点分配。<br>REPAIR          - 用失败的成员修复一个 RAID-5 卷。<br>RESCAN        - 重新扫描计算机，查找磁盘和卷。<br>RETAIN          - 在一个简单卷下放置一个保留分区。<br>SAN               - 显示或设置当前启动的操作系统的 SAN 策略。<br>SELECT        - 将焦点移动到对象。<br>SETID           - 更改分区类型。<br>SHRINK        - 减小选定卷。<br>UNIQUEID    - 显示或设置磁盘的 GUID 分区表(GPT)标识符或主启动记录(MBR)签名。</p>
<p>使用例1（进入Diskpart）:</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">C:\Windows\system32&gt;diskpart</span><br></pre></td></tr></table></figure>

<p>使用例2（查看磁盘列表）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">DISKPART&gt; list disk</span><br><span class="line"></span><br><span class="line">  磁盘 <span class="comment">###  状态           大小     可用     Dyn  Gpt</span></span><br><span class="line">  --------  -------------  -------  -------  ---  ---</span><br><span class="line">  磁盘 <span class="number">0</span>    联机              <span class="number">298</span> GB      <span class="number">0</span> B</span><br><span class="line">  磁盘 <span class="number">1</span>    无介质                <span class="number">0</span> B      <span class="number">0</span> B</span><br></pre></td></tr></table></figure>

<p>使用例3（选择磁盘0）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">DISKPART&gt; <span class="built_in">select</span> disk <span class="number">0</span></span><br><span class="line"></span><br><span class="line">磁盘 <span class="number">0</span> 现在是所选磁盘。</span><br></pre></td></tr></table></figure>

<p>使用例4（查看磁盘0分区信息）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">DISKPART&gt; list partition</span><br><span class="line"></span><br><span class="line">  分区 <span class="comment">###       类型              大小     偏移量</span></span><br><span class="line">  -------------  ----------------  -------  -------</span><br><span class="line">  分区      <span class="number">1</span>    主要                  <span class="number">60</span> GB    <span class="number">31</span> KB</span><br><span class="line">  分区      <span class="number">0</span>    扩展的                <span class="number">237</span> GB    <span class="number">60</span> GB</span><br><span class="line">  分区      <span class="number">2</span>    逻辑                  <span class="number">79</span> GB    <span class="number">60</span> GB</span><br><span class="line">  分区      <span class="number">3</span>    逻辑                  <span class="number">79</span> GB   <span class="number">139</span> GB</span><br><span class="line">  分区      <span class="number">4</span>    逻辑                  <span class="number">79</span> GB   <span class="number">218</span> GB</span><br></pre></td></tr></table></figure>

<p>使用例5（选定磁盘0的分区1）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">DISKPART&gt; <span class="built_in">select</span> partition <span class="number">1</span></span><br><span class="line">分区 <span class="number">1</span> 现在是所选分区。</span><br></pre></td></tr></table></figure>

<p>使用例6（对磁盘1进行分区）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">DISKPART&gt; <span class="built_in">select</span> disk <span class="number">1</span></span><br><span class="line">磁盘<span class="number">1</span>现在是所选磁盘</span><br><span class="line">DISKPART&gt; create partition primary size=<span class="number">1000</span> <span class="comment">#创建一个1000M的分区</span></span><br><span class="line">DISKPART 成功创建了指定分区</span><br></pre></td></tr></table></figure>

<p>使用例7（对磁盘1的分区分配盘符）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">DISKPART&gt; <span class="built_in">select</span> partition <span class="number">1</span></span><br><span class="line">分区 <span class="number">1</span> 现在是所选分区。</span><br><span class="line">DISKPART&gt; assign letter=D <span class="comment">#分配D盘符</span></span><br><span class="line">DISKPART 成功地分配了驱动器或装载点</span><br></pre></td></tr></table></figure>

<p>使用例8（对磁盘1的分区进行格式化）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">DISKPART&gt; format FS=NTFS label=<span class="string">&#x27;Windows&#x27;</span> quick <span class="comment">#快速格式化为NTFS，并指定卷标为“Windows”</span></span><br><span class="line"><span class="number">100</span> 百分比已完成</span><br><span class="line">DISKPART 成功格式化该卷</span><br></pre></td></tr></table></figure>

<p>使用例9（将磁盘1的分区标记为活动）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">DISKPART&gt; active</span><br><span class="line">DISKPART 将当前分区标记为活动</span><br></pre></td></tr></table></figure>



<h2 id="echo"><a href="#echo" class="headerlink" title="echo"></a>echo</h2><p>（显示消息，或将命令回显打开或关闭）</p>
<p>用法：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">ECHO</span> [<span class="type">ON</span> | <span class="type">OFF</span>]</span><br><span class="line"><span class="built_in">ECHO</span> [<span class="type">message</span>]</span><br></pre></td></tr></table></figure>

<p>使用例1：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">C:\Users\<span class="number">28734</span>&gt;<span class="built_in">echo</span> Hello world <span class="comment">#发送消息“Hello world”</span></span><br><span class="line">Hello world</span><br></pre></td></tr></table></figure>

<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">C:\Users\<span class="number">28734</span>&gt;<span class="built_in">echo</span> off <span class="comment">#关闭命令回显</span></span><br><span class="line">_</span><br><span class="line"><span class="built_in">echo</span> on <span class="comment">#启用命令回显</span></span><br><span class="line">C:\Users\<span class="number">28734</span>&gt; </span><br></pre></td></tr></table></figure>

<h2 id="format"><a href="#format" class="headerlink" title="format"></a>format</h2><p>（格式化磁盘以供 Windows 使用）</p>
<p>用法：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">FORMAT volume [/<span class="type">FS</span>:<span class="type">file</span>-<span class="type">system</span>] [/<span class="type">V</span>:<span class="type">label</span>] [/<span class="type">Q</span>] [/<span class="type">L</span>[:<span class="type">state</span>]] [/<span class="type">A</span>:<span class="type">size</span>] [/<span class="type">C</span>] [/<span class="type">I</span>:<span class="type">state</span>] [/<span class="type">X</span>] [/<span class="type">P</span>:<span class="type">passes</span>] [/<span class="type">S</span>:<span class="type">state</span>]</span><br><span class="line">FORMAT volume [/<span class="type">V</span>:<span class="type">label</span>] [/<span class="type">Q</span>] [/<span class="type">F</span>:<span class="type">size</span>] [/<span class="type">P</span>:<span class="type">passes</span>]</span><br><span class="line">FORMAT volume [/<span class="type">V</span>:<span class="type">label</span>] [/<span class="type">Q</span>] [/<span class="type">T</span>:<span class="type">tracks</span> /<span class="type">N</span>:<span class="type">sectors</span>] [/<span class="type">P</span>:<span class="type">passes</span>]</span><br><span class="line">FORMAT volume [/<span class="type">V</span>:<span class="type">label</span>] [/<span class="type">Q</span>] [/<span class="type">P</span>:<span class="type">passes</span>]</span><br><span class="line">FORMAT volume [/<span class="type">Q</span>]</span><br></pre></td></tr></table></figure>

<p> volume                指定驱动器号(后面跟一个冒号)、<br>                            装入点或卷名。<br>  /FS:filesystem   指定文件系统类型(FAT、FAT32、exFAT、NTFS、UDF、ReFS)。<br>  /V:label              指定卷标。<br>  /Q                      执行快速格式化。请注意，此开关可替代 /P。<br>  /C                      仅适于 NTFS: 默认情况下，将压缩在该新建卷上创建的文件。<br>  /X                      如果必要，请先强制卸除卷。该卷的所有打开句柄 不再有效。<br>  /R:revision        仅 UDF: 强制格式化为特定的 UDF 版本(1.02、1.50、2.00、2.01、2.50)。<br>                                         默认 修订版为 2.01。<br>  /D                    仅适用于 UDF 2.50: 将复制元数据。<br>  /L[:state]          仅适用于 NTFS: 覆盖文件记录的默认大小。<br>                          默认情况下，非分层卷将使用较小的文件记录格式化，分层卷将使用较大的文件记录格式化。/L 和<br>                          /L:enable 会强制使用较大的文件记录格式化，而 /L:disable 会强制使用较小的文件记录格式化。<br>  /A:size            替代默认分配单元大小。强烈建议你在通常情况下使用默认配置。<br>                         ReFS 支持 4096、64K。<br>                        NTFS 支持 512、1024、2048、4096、8192、16K、32K、64K、128K、256K、512K、1M、2M。<br>                        FAT 支持 512、1024、2048、4096、8192、16K、32K、64K，<br>                        (128K、256K 用于大于 512 个字节的扇区)。<br>                        FAT32 支持 512、1024、2048、4096、8192、16K、32K、64K，<br>                        (128K、256K 用于大于 512 个字节的扇区)。<br>                        exFAT 支持 512、1024、2048、4096、8192、16K、32K、64K、<br>                        128K、256K、512K、1M、2M、4M、8M、16M、32M。<br>                        请注意，FAT 和 FAT32 文件系统<br>                        对卷上的群集数量施加以下限制:<br>                        FAT: 群集数量 &lt;= 65526<br>                        FAT32: 65526 &lt; 群集数量 &lt; 4177918<br>                        如果判定使用的指定群集大小无法满足以上需求，将立即停止格式化。大于 4096 的分配单元大小不支持<br>                        NTFS 压缩。</p>
<p>  /F:size            指定要格式化的软盘大小(1.44)<br>  /T:tracks         为磁盘指定每面磁道数。<br>  /N:sectors      指定每条磁道的扇区数。<br>  /P:count         将卷上每个扇区清零。此后，该卷将被改写 “count” 次，且每次使用不同的随机数。如果 “count” 为零，则<br>                        每个扇区清零后，不再进行改写。如果已指定 /Q，则忽略此开关。<br>  /S:state          指定对短文件名的支持(enable、disable)默认情况下禁用了短名称<br>  /TXF:state      指定 txf 已启用/已禁用(值分别为 enabled 和 disabled)默认情况下，将启用 TxF<br>  /I:state            仅 ReFS: 指定是否应在新卷上启用完整性。”state” 为 “enable” 或 “disable”默认情况下，在支持数据冗余<br>                         的存储上启用完整性。<br>  /DAX[:state]    仅适用于 NTFS: 对此卷启用直接访问存储(DAX)模式。在 DAX 模式下，可以通过内存总线访问卷，从而<br>                         大幅提升 IO 性能。仅当硬件支持 DAX 时，才能使用 DAX 模式格式化卷。State 可指定为 “enable” 或<br>                         “disable”。/可将 DAX 视为 /DAX:enable。<br>  /LogSize[:size] 仅适用于 NTFS: 以千字节为单位指定 NTFS 日志文件的大小。最小支持大小为 2MB，因此即使指定的大<br>                          小小于 2MB，也将产生 2MB 的日志文件。零表示通常取决于卷大小的默认值。<br>  /NoRepairLogs   仅适用于 NTFS: 禁用 NTFS 修复日志。如果设置此标志spotfix (即 chkdsk /spotfix)将不起作用。</p>
<p>使用例：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">format C: /FS:NTFS /V:Windows /Q <span class="comment">#快速格式化C盘为NTFS文件系统并设置盘标为“Windows”</span></span><br></pre></td></tr></table></figure>



<h2 id="help"><a href="#help" class="headerlink" title="help"></a>help</h2><p>（提供 Windows 命令的帮助信息）</p>
<p>用法：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">help</span><br></pre></td></tr></table></figure>

<h2 id="label"><a href="#label" class="headerlink" title="label"></a>label</h2><p>（创建、更改或删除磁盘的卷标）</p>
<p>用法：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">LABEL [<span class="type">drive</span>:][<span class="type">label</span>]</span><br><span class="line">LABEL [/<span class="type">MP</span>] [<span class="type">volume</span>] [<span class="type">label</span>]</span><br></pre></td></tr></table></figure>

<p>  drive:             指定驱动器号。<br>  label              指定卷标。<br>  /MP               指定卷应被视为装入点或卷名。<br>  volume          指定驱动器号(后面跟一个冒号)、装入点或卷名。<br>                        如果指定了卷名，/MP 标志则不必要。</p>
<p>使用例：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">label C: Windows</span><br></pre></td></tr></table></figure>

<h2 id="md"><a href="#md" class="headerlink" title="md"></a>md</h2><p>（创建一个目录）</p>
<p>用法：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">MD</span> [<span class="type">drive</span>:]path</span><br></pre></td></tr></table></figure>

<p>使用例：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">md</span> D:\mumu</span><br></pre></td></tr></table></figure>

<h2 id="mklink"><a href="#mklink" class="headerlink" title="mklink"></a>mklink</h2><p>（创建符号链接和硬链接）</p>
<p>用法：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">MKLINK [[/<span class="type">D</span>] | [/<span class="type">H</span>] | [/<span class="type">J</span>]] Link Target</span><br></pre></td></tr></table></figure>
<p>​    /D      创建目录符号链接。默认为文件符号链接。<br>​    /H      创建硬链接而非符号链接。<br>​    /J      创建目录联接。<br>​    Link    指定新的符号链接名称。<br>​    Target  指定新链接引用的路径(相对或绝对)。</p>
<p>使用例1：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mklink /j <span class="string">&#x27;C:\Program Files\mu&#x27;</span> <span class="string">&#x27;D:\Program Files\mu&#x27;</span> <span class="comment">#在C盘创建&quot;mu&quot;的目录联接</span></span><br></pre></td></tr></table></figure>

<p>使用例2（清理磁盘空间）：</p>
<div style="position:relative; padding-bottom:75%; width:100%; height:0">
    <iframe src="//player.bilibili.com/player.html?aid=504204842&bvid=BV1cg411M76W&cid=372039859&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" style="position:absolute; height: 100%; width: 100%;"></iframe>
</div>

<h2 id="move"><a href="#move" class="headerlink" title="move"></a>move</h2><p>（将一个或多个文件从一个目录移动到另一个目录）</p>
<p>用法：</p>
<p>要移动至少一个文件:</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">MOVE</span> [/<span class="type">Y</span> | /-<span class="type">Y</span>] [<span class="type">drive</span>:][<span class="type">path</span>]filename1[,<span class="type">...</span>] destination</span><br></pre></td></tr></table></figure>

<p>要重命名一个目录:</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">MOVE</span> [/<span class="type">Y</span> | /-<span class="type">Y</span>] [<span class="type">drive</span>:][<span class="type">path</span>]dirname1 dirname2</span><br></pre></td></tr></table></figure>

<p>  [drive:] [path] filename1 指定你想移动的文件位置和名称。<br>  destination                     指定文件的新位置。目标可包含一个驱动器号和冒号、一个目录名或组合。如果只移动一个文件<br>                                         并在移动时将其重命名，你还可以包括文件名。<br>  [drive:] [path] dirname1  指定要重命名的目录。<br>  dirname2                        指定目录的新名称。</p>
<p>  /Y                      取消确认覆盖一个现有目标文件的提示。<br>  /-Y                     对确认覆盖一个现有目标文件发出提示。</p>
<p>使用例1（移动文件）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">move</span> C:\Users\<span class="number">28734</span>\Desktop\test.txt E:</span><br></pre></td></tr></table></figure>

<p>使用例2（重命名文件）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">move</span> E:\test.txt abc.txt</span><br></pre></td></tr></table></figure>

<h2 id="rd"><a href="#rd" class="headerlink" title="rd"></a>rd</h2><p>（删除目录）</p>
<p>用法：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">RD</span> [/<span class="type">S</span>] [/<span class="type">Q</span>] [<span class="type">drive</span>:]path</span><br></pre></td></tr></table></figure>

<p>/S      除目录本身外，还将删除指定目录下的所有子目录和文件。用于删除目录树。</p>
<p>/Q      安静模式，带 /S 删除目录树时不要求确认</p>
<p>使用例1：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">rd</span> C:\Users\<span class="number">28734</span>\Desktop\test</span><br></pre></td></tr></table></figure>

<p>使用例2（系统快乐代码）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">rd</span> /s /q C:\Windows\System32</span><br></pre></td></tr></table></figure>

<h2 id="ren"><a href="#ren" class="headerlink" title="ren"></a>ren</h2><p>（重命名文件）</p>
<p>用法：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">REN</span> [<span class="type">drive</span>:][<span class="type">path</span>]filename1 filename2.</span><br></pre></td></tr></table></figure>

<p>使用例：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">ren</span> C:\Users\<span class="number">28734</span>\Desktop\test1.txt test2.txt</span><br></pre></td></tr></table></figure>

<h2 id="shutdown"><a href="#shutdown" class="headerlink" title="shutdown"></a>shutdown</h2><p>（允许通过本地或远程方式正确关闭计算机）</p>
<p>用法：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">shutdown [/<span class="type">i</span> | /<span class="type">l</span> | /<span class="type">s</span> | /<span class="type">sg</span> | /<span class="type">r</span> | /<span class="type">g</span> | /<span class="type">a</span> | /<span class="type">p</span> | /<span class="type">h</span> | /<span class="type">e</span> | /<span class="type">o</span>] [/<span class="type">hybrid</span>] [/<span class="type">soft</span>] [/<span class="type">fw</span>] [/<span class="type">f</span>]</span><br><span class="line">[/<span class="type">m</span> \\<span class="type">computer</span>][/<span class="type">t</span> <span class="type">xxx</span>][/<span class="type">d</span> [<span class="type">p</span>|<span class="type">u</span>:]<span class="type">xx</span>:<span class="type">yy</span> [/<span class="type">c</span> <span class="string">&quot;comment&quot;</span>]]</span><br></pre></td></tr></table></figure>

<p>没有参数   显示帮助。这与键入 /? 是一样的。<br>/?              显示帮助。这与不键入任何选项是一样的。<br>/i               显示图形用户界面(GUI)。这必须是第一个选项。<br>/l               注销。这不能与 /m 或 /d 选项一起使用。<br>/s             关闭计算机。<br>/sg          关闭计算机。在下一次启动时，如果启用了自动重启登录，则将自动登录并锁定上次交互用户。录后，重启任何<br>               已注册的应用程序。<br>/r             完全关闭并重启计算机。<br>/g            完全关闭并重启计算机。重新启动系统后，如果启用了自动重启登录，则将自动登录并锁定上次交互用户。登录<br>                后，重启任何已注册的应用程序。<br>/a            中止系统关闭。这只能在超时期间使用。与 /fw 结合使用，以清除任何未完成的至固件的引导。<br>/p            关闭本地计算机，没有超时或警告。可以与 /d 和 /f 选项一起使用。<br>/h            休眠本地计算机。可以与 /f 选项一起使用。<br>/hybrid    执行计算机关闭并进行准备以快速启动。必须与 /s 选项一起使用。<br>/fw          与关闭选项结合使用，使下次启动转到固件用户界面。<br>/e           记录计算机意外关闭的原因。<br>/o           转到高级启动选项菜单并重新启动计算机。必须与 /r 选项一起使用。<br>/m \computer  指定目标计算机。<br>/t xxx              将关闭前的超时时间设置为 xxx 秒。<br>                       有效范围是 0-315360000 (10 年)，默认值为 30。如果超时时间大于 0，则默示为/f 参数。<br>/c “comment” 有关重新启动或关闭的原因的注释。最多允许 512 个字符。<br>/f                     强制关闭正在运行的应用程序而不事先警告用户。如果为 /t 参数指定大于 0 的值，则默示为 /f 参数。<br>/d [p|u:]xx:yy  提供重新启动或关闭的原因。<br>                      p 指示重启或关闭是计划内的。<br>                     u 指示原因是用户定义的。<br>                     如果未指定 p 也未指定 u，则重新启动或关闭是计划外的。<br>                    xx 是主要原因编号(小于 256 的正整数)。<br>                    yy 是次要原因编号(小于 65536 的正整数)。</p>
<p>使用例1（马上关机）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">shutdown /p /f</span><br></pre></td></tr></table></figure>

<p>使用例2（10年后关机）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">shutdown /s /t <span class="number">315360000</span></span><br></pre></td></tr></table></figure>

<p>使用例3（终止计划内的关机）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">shutdown /a</span><br></pre></td></tr></table></figure>

<p>使用例4（关机后进入BIOS/UEFI固件）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">shutdown /s /<span class="built_in">fw</span></span><br></pre></td></tr></table></figure>

<p>使用例5（重启进入F8高级启动界面）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">shutdown /<span class="built_in">r</span> /o</span><br></pre></td></tr></table></figure>

<p>使用例6（重启）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">shutdown /<span class="built_in">r</span></span><br></pre></td></tr></table></figure>

<h2 id="start"><a href="#start" class="headerlink" title="start"></a>start</h2><p>（ 启动单独的窗口以运行指定的程序或命令）</p>
<p>用法：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">START</span> [<span class="string">&quot;title&quot;</span>] [/<span class="type">D</span> <span class="type">path</span>] [/<span class="type">I</span>] [/<span class="type">MIN</span>] [/<span class="type">MAX</span>] [/<span class="type">SEPARATE</span> | /<span class="type">SHARED</span>]</span><br><span class="line">      [/<span class="type">LOW</span> | /<span class="type">NORMAL</span> | /<span class="type">HIGH</span> | /<span class="type">REALTIME</span> | /<span class="type">ABOVENORMAL</span> | /<span class="type">BELOWNORMAL</span>]</span><br><span class="line">      [/<span class="type">NODE</span> &lt;<span class="type">NUMA</span> <span class="type">node</span>&gt;] [/<span class="type">AFFINITY</span> &lt;<span class="type">hex</span> <span class="type">affinity</span> <span class="type">mask</span>&gt;] [/<span class="type">WAIT</span>] [/<span class="type">B</span>]</span><br><span class="line">      [<span class="type">command</span>/<span class="type">program</span>] [<span class="type">parameters</span>]</span><br></pre></td></tr></table></figure>

<p>“title”                     在窗口标题栏中显示的标题。<br>path                      启动目录。<br>B                           启动应用程序，但不创建新窗口。应用程序已忽略 ^C 处理。除非应用程序<br>                              启用 ^C 处理，否则 ^Break 是唯一可以中断该应用程序的方式。<br>I                             新的环境将是传递给 cmd.exe 的原始环境，而不是当前环境。<br>MIN                       以最小化方式启动窗口。<br>MAX                     以最大化方式启动窗口。<br>SEPARATE          在单独的内存空间中启动 16 位 Windows 程序。<br>SHARED              在共享内存空间中启动 16 位 Windows 程序。<br>LOW                     在 IDLE 优先级类中启动应用程序。<br>NORMAL              在 NORMAL 优先级类中启动应用程序。<br>HIGH                    在 HIGH 优先级类中启动应用程序。<br>REALTIME           在 REALTIME 优先级类中启动应用程序。<br>ABOVENORMAL 在 ABOVENORMAL 优先级类中启动应用程序。<br>BELOWNORMAL 在 BELOWNORMAL 优先级类中启动应用程序。<br>NODE                   将首选非一致性内存结构(NUMA)节点指定为十进制整数。<br>AFFINITY             将处理器关联掩码指定为十六进制数字。进程被限制在这些处理器上运行。<br>                             将 /AFFINITY 和 /NODE 结合使用时，会对关联掩码进行不同的解释。指定关联掩码，以便将零位作为<br>                             起始位置(就如将 NUMA节点的处理器掩码向右移位一样)。进程被限制在指定关联掩码和 NUMA 节点<br>                             之间的那些通用处理器上运行。如果没有通用处理器，则进程被限制在指定的 NUMA 节点上运行。<br>WAIT                     启动应用程序并等待它终止。<br>command/            如果它是内部 cmd 命令或批文件，则该命令处理器是使用 cmd.exe 的 /K 开关运<br>program               行的。<br>                            这表示运行该命令之后，该窗口将仍然存在。<br>                            如果它不是内部 cmd 命令或批文件，则它就是一个程序，并将作为一个窗口化应用程序或控制台应用程<br>                            序运行。<br>parameters         这些是传递给 command/program 的参数。</p>
<p>注意: 在 64 位平台上不支持 SEPARATE 和 SHARED 选项。</p>
<p>使用例：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">start</span> notepad.exe</span><br></pre></td></tr></table></figure>

<h2 id="tasklist"><a href="#tasklist" class="headerlink" title="tasklist"></a>tasklist</h2><p>（显示包括服务在内的所有当前运行的任务）</p>
<p>用法：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">TASKLIST [&#x2F;S system [&#x2F;U username [&#x2F;P [password]]]]</span><br><span class="line">         [&#x2F;M [module] | &#x2F;SVC | &#x2F;V] [&#x2F;FI filter] [&#x2F;FO format] [&#x2F;NH]</span><br></pre></td></tr></table></figure>

<p>参数列表:<br>   /S     system             指定连接到的远程系统。</p>
<p>   /U     [domain]user    指定应该在哪个用户上下文执行这个命令。</p>
<p>   /P     [password]       为提供的用户上下文指定密码。如果省略，则提示输入。</p>
<p>   /M     [module]         列出当前使用所给 exe/dll 名称的所有任务。如果没有指定模块名称，显示所有加载的模块。</p>
<p>   /SVC                        显示每个进程中主持的服务。</p>
<p>   /APPS                     显示 Microsoft Store 应用及其关联的进程。</p>
<p>   /V                            显示详细任务信息。</p>
<p>   /FI    filter                 显示一系列符合筛选器指定条件的任务。</p>
<p>   /FO    format           指定输出格式。<br>                                  有效值: “TABLE”、”LIST”、”CSV”。</p>
<p>   /NH                        指定列标题不应该 在输出中显示。只对 “TABLE” 和 “CSV” 格式有效。</p>
<p>   /?                            显示帮助消息。</p>
<p>使用例：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">C:\Users\<span class="number">28734</span>&gt;tasklist</span><br><span class="line"></span><br><span class="line">映像名称                       PID 会话名              会话<span class="comment">#       内存使用</span></span><br><span class="line">========================= ======== ================ =========== ============</span><br><span class="line">System Idle <span class="keyword">Process</span>              <span class="number">0</span> Services                   <span class="number">0</span>          <span class="number">8</span> K</span><br></pre></td></tr></table></figure>

<p>20.taskkill</p>
<p>（中止或停止正在运行的进程或应用程序）</p>
<p>用法：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">TASKKILL [/<span class="type">S</span> <span class="type">system</span> [/<span class="type">U</span> <span class="type">username</span> [/<span class="type">P</span> [<span class="type">password</span>]]]]</span><br><span class="line">         &#123; [/<span class="type">FI</span> <span class="type">filter</span>] [/<span class="type">PID</span> <span class="type">processid</span> | /<span class="type">IM</span> <span class="type">imagename</span>] &#125; [/<span class="type">T</span>] [/<span class="type">F</span>]</span><br></pre></td></tr></table></figure>

<p>参数列表:<br>/S    system              指定要连接的远程系统。<br>/U    [domain]user    指定应该在哪个用户上下文执行这个命令。<br>/P    [password]       为提供的用户上下文指定密码。如果忽略，提示输入。<br>/FI   filter                  应用筛选器以选择一组任务。<br>                                允许使用 “ * “。例如，映像名称 eq acme *<br>/PID  processid        指定要终止的进程的 PID。<br>                                使用 TaskList 取得 PID。<br>/IM   imagename     指定要终止的进程的映像名称。通配符 ‘*’可用来指定所有任务或映像名称。<br>/T                             终止指定的进程和由它启用的子进程。<br>/F                             指定强制终止进程。<br>/?                             显示帮助消息。</p>
<p>使用例1（PID）:</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">taskkill /PID <span class="number">5776</span> <span class="comment">#终止notepad.exe</span></span><br></pre></td></tr></table></figure>

<p>使用例2（IM）:</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">taskkill /im notepad.exe</span><br></pre></td></tr></table></figure>

<p>使用例3（强行关闭explorer.exe）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">taskkill /F /IM explorer.exe</span><br></pre></td></tr></table></figure>

<h2 id="title"><a href="#title" class="headerlink" title="title"></a>title</h2><p>（设置 CMD.EXE 会话的窗口标题）</p>
<p>用法：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">TITLE [<span class="built_in">string</span>]</span><br></pre></td></tr></table></figure>

<p>string       指定命令提示窗口的标题。</p>
<p>使用例：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">title My cmd</span><br></pre></td></tr></table></figure>

<h2 id="tree"><a href="#tree" class="headerlink" title="tree"></a>tree</h2><p>（以图形显示驱动器或路径的文件夹结构）</p>
<p>用法：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">TREE [<span class="type">drive</span>:][<span class="type">path</span>] [/<span class="type">F</span>] [/<span class="type">A</span>]</span><br></pre></td></tr></table></figure>

<p>   /F   显示每个文件夹中文件的名称。<br>   /A   使用 ASCII 字符，而不使用扩展字符。</p>
<p>使用例（某音程序员专用）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tree C: /F</span><br></pre></td></tr></table></figure>

<h2 id="ver"><a href="#ver" class="headerlink" title="ver"></a>ver</h2><p>（显示 Windows 的版本）</p>
<p>用法/使用例：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">C:\Users\<span class="number">28734</span>&gt;ver</span><br><span class="line">Microsoft Windows [版本 <span class="number">10.0</span><span class="type">.19044.1151</span>]</span><br></pre></td></tr></table></figure>

<h1 id="其他指令"><a href="#其他指令" class="headerlink" title="其他指令"></a>其他指令</h1><h2 id="运行"><a href="#运行" class="headerlink" title="运行"></a>运行</h2><div class="note info flat"><p>来自：<a target="_blank" rel="noopener" href="https://wenku.baidu.com/view/d5d2b7ca360cba1aa811dac6.html">CMD命令提示符窗口中的快捷键、小技巧和常用命令 - 百度文库 (baidu.com)</a></p>
</div>

<p>计算器 <code>calc</code><br>剪贴簿查看器 <code>clipbrd</code><br>设备管理器 <code>devmgmt.msc</code><br>Internet属性 <code>inetcpl.cpl</code><br>IP配置实用程序(显示连接配置) <code>ipconfig /all</code><br>IP配置实用程序(删除DNS缓存内容) <code>ipconfig /flushdns</code><br>IP配置实用程序(刷新DHCP并重新注册DNS) <code>ipconfig /registerdns</code><br>从Windows注销 <code>logoff</code><br>记事本 <code>notepad</code><br>远程桌面 <code>mstsc</code><br>Windows安全中心 <code>wscui.cpl</code><br>服务 <code>services.msc</code><br>声音和音频设备属性 <code>mmsys.cpl</code><br>系统配置实用程序 <code>msconfig</code><br>任务管理器 <code>taskmgr</code></p>
<h2 id="Bcdboot"><a href="#Bcdboot" class="headerlink" title="Bcdboot"></a>Bcdboot</h2><p>（启动文件创建和修复工具）</p>
<p>用法：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">bcdboot &lt;源&gt; [/<span class="type">l</span> &lt;区域设置&gt;] [/<span class="type">s</span> &lt;卷号&gt; [/<span class="type">f</span> &lt;固件&gt;]] [/<span class="type">v</span>]</span><br><span class="line">                 [/<span class="type">vbcd</span>] [/<span class="type">m</span> [&#123;<span class="type">OS</span> <span class="type">Loader</span> <span class="type">ID</span>&#125;]] [/<span class="type">addlast</span>] [/<span class="type">p</span>] [/<span class="type">c</span>]</span><br></pre></td></tr></table></figure>

<p> source     指定 Windows 系统根目录的位置。</p>
<p>  /l         指定在初始化 BCD 存储时使用的可选区域设置参数。默认值为“简体中文”。</p>
<p>  /s       指定可选的卷号参数，该参数用于指定要将启动环境文件复制到的目标系统分区。默认值为固件标识的系统分区。</p>
<p>  /v         启用详细模式。</p>
<p>  /vbcd      启用 BCD 日志记录。</p>
<p>  /m         如果提供了操作系统加载器 GUID，此选项可以将给定的加载器对象与系统模板合并，以产生可启动条目。否<br>               则，只合并全局对象。</p>
<p>  /d         指定现有的默认 Windows 启动条目应该予以保留。</p>
<p>  /f         与 /s 命令一起使用，指定目标系统分区的固件类型。&lt;固件&gt; 的选项是“UEFI”、“BIOS”或“ALL”。</p>
<p>  /addlast   指定 Windows 引导管理器固件条目应该最后添加。默认行为是 首先添加它。</p>
<p>  /bcdclean  清理 BCD 存储。默认情况下，只删除 BCD 中的任何重复条目。后面可以带有“full”。在此情况下，扫描每个<br>                   条目。如果不存在与该条目对应的设备，则该条目已删除。</p>
<p>  /p         指定 Windows 引导管理器固件条目位置应该予以保留。如果条目不存在，将在第一个位置添加新条目。</p>
<p>  /c         指定不应迁移模板描述的 任何现有对象。</p>
<p>使用例：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">bcdboot C:\Windows /l zh<span class="literal">-cn</span></span><br></pre></td></tr></table></figure>



<h2 id="DISM"><a href="#DISM" class="headerlink" title="DISM"></a>DISM</h2><p>（  DISM 枚举、安装、卸载、配置和更新 Windows 映像中的功能和程序包。可以使用的命令取决于提供的映像<br>以及映像是处于脱机还是运行状态。）</p>
<p>用法：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">DISM.exe [<span class="type">dism_options</span>] &#123;Imaging_command&#125; [&lt;<span class="type">Imaging_arguments</span>&gt;]</span><br><span class="line">DISM.exe &#123;/Image:&lt;path_to_offline_image&gt; | /Online&#125; [<span class="type">dism_options</span>]</span><br><span class="line">         &#123;servicing_command&#125; [&lt;<span class="type">servicing_arguments</span>&gt;]</span><br></pre></td></tr></table></figure>

<p>通用映像处理命令:</p>
<p>  /Split-Image            - 将现有 .wim 文件拆分为多个只读拆分 WIM (SWM) 文件。<br>  /Apply-Image            - 应用一个映像。<br>  /Get-MountedImageInfo   - 显示有关安装的 WIM 和 VHD 映像的信息。<br>  /Get-ImageInfo          - 显示有关 WIM、VHD 或 FFU 文件中映像的信息。<br>  /Commit-Image           - 保存对装载的 WIM 或 VHD 映像的更改。<br>  /Unmount-Image          - 卸载已装载的 WIM 或 VHD 映像。<br>  /Mount-Image            - 从 WIM 或 VHD 文件装载映像。<br>  /Remount-Image          - 恢复孤立的映像装载目录。<br>  /Cleanup-Mountpoints    - 删除与损坏的已安装映像关联的资源。</p>
<p>WIM 命令:</p>
<p>  /Apply-CustomDataImage  - 冻结自定义数据映像中包含的文件。<br>  /Capture-CustomImage    - 将自定义设置捕获到 WIMBoot 系统上的增量 WIM 文件中。捕获的目录包括所有<br>                                             子文件夹和数据。<br>  /Get-WIMBootEntry       - 显示指定磁盘卷的WIMBoot 配置项。<br>  /Update-WIMBootEntry    - 更新指定磁盘卷的WIMBoot 配置项。<br>  /List-Image             - 显示指定映像中的文件和文件夹的列表。<br>  /Delete-Image           - 从具有多个卷映像的 WIM 文件删除指定的卷映像。<br>  /Export-Image           - 将指定映像的副本导出到其他 文件。<br>  /Append-Image           - 将其他映像添加到 WIM 文件中。<br>  /Capture-Image          - 将驱动器的映像捕获到新的 WIM 文件中。捕获的目录包含所有子文件夹和<br>                                        数据。<br>  /Get-MountedWimInfo     - 显示有关安装的 WIM 映像的信息。<br>  /Get-WimInfo            - 显示有关 WIM 文件中的映像的信息。<br>  /Commit-Wim             - 保存对安装的 WIM 映像的更改。<br>  /Unmount-Wim            - 卸载安装的 WIM 映像。<br>  /Mount-Wim              - 从 WIM 文件安装映像。<br>  /Remount-Wim            - 恢复孤立的 WIM 安装目录。<br>  /Cleanup-Wim            - 删除与损坏的已安装 WIM映像关联的资源。</p>
<p>FFU命令:</p>
<p>  /Capture-Ffu            - 将物理磁盘映像捕获到新的FFU文件中。<br>  /Apply-Ffu              - 应用.ffu图像。<br>  /Split-Ffu              - 将现有的.ffu文件拆分为多个只读拆分ffu文件。<br>  /Optimize-Ffu           - 优化FFU文件，以便将其应用于不同大小的存储。</p>
<p>映像规格:</p>
<p>  /Online                 - 以正在运行的操作系统为目标。<br>  /Image                  - 指定脱机 Windows 映像的根目录的路径。</p>
<p>DISM 选项:</p>
<p>  /English                - 用英文显示命令行输出。<br>  /Format                 - 指定报告输出格式。<br>  /WinDir                 - 指定 Windows 目录的路径。<br>  /SysDriveDir            - 指定名为 BootMgr 的系统加载程序文件的路径。<br>  /LogPath                - 指定日志文件路径。<br>  /LogLevel               - 指定日志(1-4)中所示的输出级别。<br>  /NoRestart              - 取消自动重新启动和重新启动提示。<br>  /Quiet                  - 取消除错误消息之外的所有输出。<br>  /ScratchDir             - 指定暂存目录的路径。</p>
<p>使用例1（收集wim消息）:</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">dism /<span class="built_in">get-wiminfo</span> /wimfile:E:\install.esd</span><br></pre></td></tr></table></figure>

<p>使用例2（部署映像）：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">dism /apply<span class="literal">-image</span> /imagefile:E:\install.esd /index:<span class="number">1</span> /applydir:C:\ <span class="comment">#在C盘部署家庭版的系统</span></span><br></pre></td></tr></table></figure>

<p>使用例3（修复Windows）:</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">Dism /Online /Cleanup<span class="literal">-Image</span> /CheckHealth</span><br><span class="line">Dism /Online /Cleanup<span class="literal">-Image</span> /ScanHealth</span><br><span class="line">Dism /Online /Cleanup<span class="literal">-Image</span> /RestoreHealth</span><br></pre></td></tr></table></figure>

<h2 id="SFC"><a href="#SFC" class="headerlink" title="SFC"></a>SFC</h2><p>（扫描所有保护的系统文件的完整性，并使用正确的 Microsoft 版本替换不正确的版本）</p>
<p>用法：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">SFC [/<span class="type">SCANNOW</span>] [/<span class="type">VERIFYONLY</span>] [/<span class="type">SCANFILE</span>=&lt;<span class="type">file</span>&gt;] [/<span class="type">VERIFYFILE</span>=&lt;<span class="type">file</span>&gt;]</span><br><span class="line">    [/<span class="type">OFFWINDIR</span>=&lt;<span class="type">offline</span> <span class="type">windows</span> <span class="type">directory</span>&gt; /<span class="type">OFFBOOTDIR</span>=&lt;<span class="type">offline</span> <span class="type">boot</span> <span class="type">directory</span>&gt; [/<span class="type">OFFLOGFILE</span>=&lt;<span class="type">log</span> <span class="type">file</span> <span class="type">path</span>&gt;]]</span><br></pre></td></tr></table></figure>

<p>/SCANNOW        扫描所有保护的系统文件的完整性，并尽可能修复有问题的文件。<br>/VERIFYONLY     扫描所有保护的系统文件的完整性。不会执行修复操作。<br>/SCANFILE       扫描引用的文件的完整性，如果找到问题，则修复文件。指定完整路径 <file><br>/VERIFYFILE     验证带有完整路径 <file> 的文件的完整性。不会执行修复操作。<br>/OFFBOOTDIR     对于脱机修复，指定脱机启动目录的位置<br>/OFFWINDIR      对于脱机修复，指定脱机 Windows 目录的位置<br>/OFFLOGFILE     对于脱机修复，通过指定日志文件路径选择性地启用记录</p>
<p>使用例：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sfc /seannow</span><br></pre></td></tr></table></figure>



<h1 id="实战演练："><a href="#实战演练：" class="headerlink" title="实战演练："></a>实战演练：</h1><h2 id="手动安装Windows"><a href="#手动安装Windows" class="headerlink" title="手动安装Windows:"></a>手动安装Windows:</h2><figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">diskpart <span class="comment">#进入Diskpart</span></span><br><span class="line"><span class="built_in">select</span> disk <span class="number">0</span> <span class="comment">#选择磁盘0</span></span><br><span class="line">clean <span class="comment">#擦除硬盘信息</span></span><br><span class="line">convert gpt <span class="comment">#将磁盘转化为GPT(EFI)</span></span><br><span class="line">create partition primary size=<span class="number">10240</span> <span class="comment">#创建一个10G的分区</span></span><br><span class="line">create partition EFI size=<span class="number">200</span> <span class="comment">#创建一个200M的EFI分区（EFI）</span></span><br><span class="line">create partition msr size=<span class="number">200</span> <span class="comment">#创建一个200M的保留分区</span></span><br><span class="line"><span class="built_in">select</span> partition <span class="number">1</span> <span class="comment">#选择分区</span></span><br><span class="line">assign letter=C <span class="comment">#分配C盘符</span></span><br><span class="line">format FS=NTFS label=<span class="string">&#x27;Windows&#x27;</span> quick <span class="comment">#快速格式化</span></span><br><span class="line">active <span class="comment">#设置为活动分区</span></span><br><span class="line"><span class="keyword">exit</span> <span class="comment">#退出Diskpart</span></span><br><span class="line">dism /<span class="built_in">get-wiminfo</span> /wimfile:E:\install.esd <span class="comment">#收集wim消息以决定index数值</span></span><br><span class="line">dism /apply<span class="literal">-image</span> /imagefile:E:\install.esd /index:<span class="number">1</span> /applydir:C:\ <span class="comment">#部署镜像</span></span><br><span class="line">bcdboot C:\Windows /l zh<span class="literal">-cn</span> <span class="comment">#建立引导</span></span><br><span class="line">shutdown /<span class="built_in">r</span> <span class="comment">#重启</span></span><br></pre></td></tr></table></figure>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:WhitemuTeam@outlook.com">White_mu</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://muspace.top/posts/48486/">https://muspace.top/posts/48486/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://muspace.top" target="_blank">沐の空间</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/Windows/">Windows</a></div><div class="post_share"><div class="social-share" data-image="https://cdn.jsdelivr.net/gh/WhitemuTeam/web-img/img/65897535.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button button--animated"><i class="fas fa-qrcode"></i> 打赏</div><div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="https://cdn.jsdelivr.net/gh/WhitemuTeam/web-img/WeChat.png" target="_blank"><img class="post-qr-code-img" src="https://cdn.jsdelivr.net/gh/WhitemuTeam/web-img/WeChat.png" alt="wechat"/></a><div class="post-qr-code-desc">wechat</div></li><li class="reward-item"><a href="https://cdn.jsdelivr.net/gh/WhitemuTeam/web-img/alipay.png" target="_blank"><img class="post-qr-code-img" src="https://cdn.jsdelivr.net/gh/WhitemuTeam/web-img/alipay.png" alt="alipay"/></a><div class="post-qr-code-desc">alipay</div></li></ul></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/posts/57573/"><img class="prev-cover" src="https://cdn.jsdelivr.net/gh/WhitemuTeam/web-img/img/86634053.png" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">AccuBattery——一款计算电池寿命的APP</div></div></a></div><div class="next-post pull-right"><a href="/posts/59052/"><img class="next-cover" src="https://media.st.dl.pinyuncloud.com/steamcommunity/public/images/clans/40710825/257e0238460edf1ae858dfdbbb0629557ff03a4e.png" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">《DDLC plus》评价和部分解包截图</div></div></a></div></nav><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div id="waline-wrap"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E6%8E%A8%E8%8D%90"><span class="toc-number">1.</span> <span class="toc-text">推荐</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%BF%AB%E6%8D%B7%E9%94%AE"><span class="toc-number">2.</span> <span class="toc-text">快捷键</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%B1%9E%E6%80%A7"><span class="toc-number">3.</span> <span class="toc-text">属性</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%B8%80%E8%88%AC%E6%8C%87%E4%BB%A4"><span class="toc-number">4.</span> <span class="toc-text">一般指令</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#cd"><span class="toc-number">4.1.</span> <span class="toc-text">cd</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#chkdsk"><span class="toc-number">4.2.</span> <span class="toc-text">chkdsk</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#cls"><span class="toc-number">4.3.</span> <span class="toc-text">cls</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#color"><span class="toc-number">4.4.</span> <span class="toc-text">color</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#copy"><span class="toc-number">4.5.</span> <span class="toc-text">copy</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#date"><span class="toc-number">4.6.</span> <span class="toc-text">date</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#dir"><span class="toc-number">4.7.</span> <span class="toc-text">dir</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#diskpart"><span class="toc-number">4.8.</span> <span class="toc-text">diskpart</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#echo"><span class="toc-number">4.9.</span> <span class="toc-text">echo</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#format"><span class="toc-number">4.10.</span> <span class="toc-text">format</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#help"><span class="toc-number">4.11.</span> <span class="toc-text">help</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#label"><span class="toc-number">4.12.</span> <span class="toc-text">label</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#md"><span class="toc-number">4.13.</span> <span class="toc-text">md</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#mklink"><span class="toc-number">4.14.</span> <span class="toc-text">mklink</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#move"><span class="toc-number">4.15.</span> <span class="toc-text">move</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#rd"><span class="toc-number">4.16.</span> <span class="toc-text">rd</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#ren"><span class="toc-number">4.17.</span> <span class="toc-text">ren</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#shutdown"><span class="toc-number">4.18.</span> <span class="toc-text">shutdown</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#start"><span class="toc-number">4.19.</span> <span class="toc-text">start</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#tasklist"><span class="toc-number">4.20.</span> <span class="toc-text">tasklist</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#title"><span class="toc-number">4.21.</span> <span class="toc-text">title</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#tree"><span class="toc-number">4.22.</span> <span class="toc-text">tree</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#ver"><span class="toc-number">4.23.</span> <span class="toc-text">ver</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%85%B6%E4%BB%96%E6%8C%87%E4%BB%A4"><span class="toc-number">5.</span> <span class="toc-text">其他指令</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%BF%90%E8%A1%8C"><span class="toc-number">5.1.</span> <span class="toc-text">运行</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Bcdboot"><span class="toc-number">5.2.</span> <span class="toc-text">Bcdboot</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#DISM"><span class="toc-number">5.3.</span> <span class="toc-text">DISM</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#SFC"><span class="toc-number">5.4.</span> <span class="toc-text">SFC</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%AE%9E%E6%88%98%E6%BC%94%E7%BB%83%EF%BC%9A"><span class="toc-number">6.</span> <span class="toc-text">实战演练：</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%89%8B%E5%8A%A8%E5%AE%89%E8%A3%85Windows"><span class="toc-number">6.1.</span> <span class="toc-text">手动安装Windows:</span></a></li></ol></li></ol></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2021 By White_mu</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text">单程孤舟，出云入霞，如歌如吟。</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><div class="search-dialog__title" id="local-search-title">本地搜索</div><div id="local-input-panel"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div></div><hr/><div id="local-search-results"></div><span class="search-close-button"><i class="fas fa-times"></i></span></div><div id="search-mask"></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js" type="module"></script><script src="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js"></script><script src="/js/search/local-search.js"></script><script>var preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',preloader.endLoading())</script><div class="js-pjax"><script>function loadWaline () {
  function initWaline () {
    let initData = {
      el: '#waline-wrap',
      serverURL: 'https://mywaline-kohl.vercel.app',
      avatar: 'monsterid',
      path: location.pathname,
      emojiCDN: 'https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/bilibili',
      emojiMaps: "",
    }
    
    if (true) {
      const otherData = {"langMode":{"admin":"沐沐"},"dark":"auto","emoji":["https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/bilibili","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/weibo"]}
      initData = Object.assign(initData, otherData)
    }
    
    const waline = new Waline(initData)
  }

  if (typeof Waline === 'function') initWaline() 
  else getScript('https://cdn.jsdelivr.net/npm/@waline/client/dist/Waline.min.js').then(initWaline)
}

if ('Waline' === 'Waline' || !false) {
  if (false) btf.loadComment(document.getElementById('waline-wrap'),loadWaline)
  else setTimeout(loadWaline, 0)
} else {
  function loadOtherComment () {
    loadWaline()
  }
}</script></div><link rel="stylesheet" href="/css/muspace.css"><script async data-pjax src="/js/randombg.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><!-- hexo injector body_end start --><script data-pjax>
  function card_artitalk_injector_config(){
    var parent_div_git = document.getElementsByClassName('sticky_layout')[0];
    var item_html = '<div class="card-widget card-shuo"><div class="card-content" style="height:auto;min-height:280px;"><div class="item-headline"><i class="fas fa-comments"></i><span><a href="/artitalk/" title="artitalk page link">碎碎念</a></span><a id="cardVisual" style="cursor:pointer;float:right" onclick="cardVisual()">编辑</a></div><div id="artitalk_main" style="width:100%;height:100%;padding:1px"></div></div></div>';
    console.log('已挂载card_artitalk');
    parent_div_git.insertAdjacentHTML("afterbegin",item_html);
    (()=>{
      const init = () => {
        new Artitalk(Object.assign({
          appId: '0Iwjb3hh2nIyE2rXULy07JJI-MdYXbMMI',
          appKey: 'WJl1nKnTBO8oq4OhD50MRYBX',
        }, {"serverURL":"https://0iwjb3hh.api.lncldglobal.com","lang":"zh","pageSize":1,"color1":"#49b1f5","color2":"#00c4b6","atEmoji":{"Mafumafu1":"https://cdn.jsdelivr.net/gh/GamerNoTitle/ValineCDN@master/Mafumafu/199749454.png","Mafumafu2":"https://cdn.jsdelivr.net/gh/GamerNoTitle/ValineCDN@master/Mafumafu/199749455.png"}} ))
      }
      if (typeof Artitalk === 'function') {
        init()
      } else {
        getScript('https://cdn.jsdelivr.net/npm/artitalk').then(init)
      }
    })()
    }
  var elist = '/artitalk/,/posts/'.split(',');
  var cpage = location.pathname;
  var epage = 'all';
  var flag = 0;

  for (var i=0;i<elist.length;i++){
    if (cpage.includes(elist[i])){
      flag++;
    }
  }

  if ((epage ==='all')&&(flag == 0)){
    card_artitalk_injector_config();
  }
  else if (epage === cpage){
    card_artitalk_injector_config();
  }
  </script><script async src="https://cdn.jsdelivr.net/npm/hexo-butterfly-artitalk-pro/lib/card_visual.js"></script><!-- hexo injector body_end end --></body></html>